package br.com.paiva.container.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import br.com.paiva.container.Aeroporto;
import br.com.paiva.container.dao.AeroportoDAO;
import br.com.paiva.container.service.AeroportoService;

@Service("aeroportoService")
public class AeroportoServiceImpl implements AeroportoService {
	
	@Autowired
	private AeroportoDAO aeroportoDAO;
	
	public void setAeroportoDAO(AeroportoDAO aeroportoDAO) {
		this.aeroportoDAO = aeroportoDAO;
	}

	@Transactional(propagation=Propagation.REQUIRED)
	public void save(Aeroporto aeroporto) {
		
		this.aeroportoDAO.save(aeroporto);
		
	}
	
	public List<Aeroporto> list() {
		return this.aeroportoDAO.list();
	}
	
	public Aeroporto getAeroportoById(Long id) {
		return this.aeroportoDAO.retrive(id);
	}
	
	public void delete(Long id) {
		// TODO Auto-generated method stub
		
	}

	public List<String> searchAeroporto(String nome) {
		return this.aeroportoDAO.searchAeroporto(nome);
	}
	
}
